import socket

s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)

# 获取本地主机名
host = socket.gethostname()

# 设置端口号
port = 9999

s.connect((host,port))

msg = s.recv(1024)

s.close()

print(msg.decode('utf-8'))